import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import notFoundVue from "../views/notFound/notFound.vue";
const routes: Array<RouteRecordRaw> = [
  {
    path: "/:pathMatch(.*)",
    component: notFoundVue,
  },
  {
    path: "/",
    redirect: { path: "/login" },
  },
  {
    path: "/home",
    component: () => import("../views/home/Index.vue"),
    redirect: { path: "/home/homepage" },
    children: [
      {
        path: "/home/homepage",
        component: () => import("../views/homeItem/HomePage.vue"),
      },
      {
        path: "/home/community",
        component: () => import("../views/homeItem/Community.vue"),
      },
      {
        path: "/home/monitor",
        component: () => import("../views/homeItem/Monitor.vue"),
      },
      { path: "/home/my", component: () => import("../views/homeItem/My.vue") },
    ],
  },
  {
    path: "/login",
    component: () => import("../views/login/Login.vue"),
  },
  {
    path: "/register",
    component: () => import("../views/login/Register.vue"),
  },
];
const router = createRouter({
  history: createWebHistory("/api/"),
  routes,
});

export default router;
